<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'mainFrame.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body bgcolor="pink">
    
    <h2 align="center">留言板</h2>
    
    <p align="center">..............................致...我...们...终...将...逝...去...的...青...春...............................</p>
    
    <table border="1" width="80%" align="center" bordercolor="red">
    
    <tr><th>序号</th><th>标题</th><th>作者</th><th>发表时间</th><th>修改</th><th>删除</th><th>查看</th></tr>
    <c:forEach items="${list }" var="article" varStatus="s">
	    <tr><td align="center">${s.index + 1 }</td>
	    <td align="center">${article.title }</td>
	    <td align="center">${article.user.username }</td>
	    <td align="center"><fmt:formatDate value="${article.publishDate}" pattern="yyyy/MM/dd HH:mm:ss" var="d"/>${d }</td>
	    <td align="center"><a href="gotoModifyView.action?articleId=${article.id }">修改</a></td>
	    <td align="center"><a href="delete.action?articleId=${article.id }">删除</a></td>
	    <td align="center"><a href="getSingleArticle?articleId=${article.id }">查看</a></td></tr>
    </c:forEach>
    
    </table>
    
    <table width="60%"  border="0" cellspacing="0" cellpadding="0" align="center">
	  <tr>
	  	<td><a href="publish.jsp">发表文章</a></td>
	  	
	    <td align="right">当前页数：[${pageNow }/${pageCount }]&nbsp;
		
		<a href="fenye.action?pageNow=1">第一页</a>　
		<c:if test="${pageNow > 1 }">
		      <a href="fenye.action?pageNow=${pageNow - 1 }">上一页</a>
		</c:if>
		<c:if test="${pageNow != pageCount }">
		      <a href="fenye.action?pageNow=${pageNow + 1 }">下一页</a>
		</c:if>
		<a href="fenye.action?pageNow=${pageCount }">最后一页&nbsp;</a>
		
		</td>
	  </tr>
	</table>
    
  </body>
</html>
